<html>
<head><meta charset="utf-8"><title>syntax support · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html">syntax support</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="173163930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173163930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173163930">(Aug 14 2019 at 00:20)</a>:</h4>
<p>Hey. You guys aware of the issue with <code>static move</code> closures at present?</p>



<a name="173164081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173164081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173164081">(Aug 14 2019 at 00:23)</a>:</h4>
<p>(or <code>yield</code> for that matter)</p>



<a name="173179995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173179995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173179995">(Aug 14 2019 at 07:02)</a>:</h4>
<p>no, what are static closures?</p>



<a name="173182891"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173182891" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173182891">(Aug 14 2019 at 08:05)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/parser/expr.rs#L887-L889" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/parser/expr.rs#L887-L889">https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/parser/expr.rs#L887-L889</a> discusses static closures.</p>



<a name="173182986"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173182986" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173182986">(Aug 14 2019 at 08:06)</a>:</h4>
<p>It seems to be for making automatically <code>Pin</code>ned closures?</p>



<a name="173183000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173183000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173183000">(Aug 14 2019 at 08:06)</a>:</h4>
<p>See <a href="https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/parser/expr.rs#L1093-L1097" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/parser/expr.rs#L1093-L1097">https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/parser/expr.rs#L1093-L1097</a></p>



<a name="173183040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173183040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173183040">(Aug 14 2019 at 08:07)</a>:</h4>
<p>And <a href="https://github.com/rust-lang/rust/pull/45337" target="_blank" title="https://github.com/rust-lang/rust/pull/45337">https://github.com/rust-lang/rust/pull/45337</a></p>



<a name="173183188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173183188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173183188">(Aug 14 2019 at 08:10)</a>:</h4>
<p>I must say that I have never seen that syntax before, and it feels like it has been superceded by <code>Pin</code>. <span class="user-mention" data-user-id="116466">@Zoxc</span> seems to have made that PR - can you shed any more light?</p>



<a name="173183439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173183439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173183439">(Aug 14 2019 at 08:14)</a>:</h4>
<p><code>static</code> is for immovable generators (used for async), while leaving it off gives a regular movable generator</p>



<a name="173183693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173183693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173183693">(Aug 14 2019 at 08:17)</a>:</h4>
<p>I didn't even know we had immovable types still - I thought that was all supplanted by Pin</p>



<a name="173183755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173183755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173183755">(Aug 14 2019 at 08:18)</a>:</h4>
<p>I thought I understood it, but perhaps I don't :P. It is very subtle</p>



<a name="173183899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173183899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173183899">(Aug 14 2019 at 08:20)</a>:</h4>
<p>Generators without the <code>static</code>keyword implements <code>Unpin</code>, the ones with it do not.</p>



<a name="173184031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173184031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173184031">(Aug 14 2019 at 08:23)</a>:</h4>
<p>Oh no! I've just lost all my understanding of how you can't just create a Pin, then let the pin drop and use the reference again.</p>



<a name="173184055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173184055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173184055">(Aug 14 2019 at 08:23)</a>:</h4>
<p>Not that's it's your job to try and teach me.</p>



<a name="173184466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173184466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173184466">(Aug 14 2019 at 08:31)</a>:</h4>
<p>Oh never mind, making a Pin from an &amp;mut is unsafe.</p>



<a name="173184469"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173184469" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173184469">(Aug 14 2019 at 08:31)</a>:</h4>
<p>Mischief managed.</p>



<a name="173186962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173186962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Daniel Mcnab <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173186962">(Aug 14 2019 at 09:15)</a>:</h4>
<p>Thanks <span class="user-mention" data-user-id="116466">@Zoxc</span>! I guess we need to clarify our unstable syntax tracking. Perhaps we are at a point where we can add support for #![feature] crate attributes</p>



<a name="173802876"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/syntax%20support/near/173802876" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alexander Regueiro <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/syntax.20support.html#173802876">(Aug 21 2019 at 15:09)</a>:</h4>
<p>Ah right. Would be good to document this syntax more. It's not in the Unstable Book, is it <span class="user-mention" data-user-id="116466">@Zoxc</span> ?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>